package cn.lingyangwl.agile.gateway;

import cn.lingyangwl.agile.gateway.model.ram.*;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * @author shenguangyang
 */
@Component
public class GatewayRunner implements ApplicationRunner {
    @Resource
    private RabbitTemplate rabbitTemplate;

    @Override
    public void run(ApplicationArguments args) throws Exception {

        ResourceSyncMQ mq = new ResourceSyncMQ();
        mq.setRamModuleList(new ArrayList<>());
        // 初始化资源模块
        rabbitTemplate.convertAndSend(ResourceSyncMQ.EXCHANGE_INIT, ResourceSyncMQ.KEY_NOTICE_INIT, mq.toMessage());
    }
}
